<?php 
	include_once('class/autoload.php');
	global $connexion;
	$keyword='%'.strtoupper($_GET['term']).'%';
	$sth = $connexion->prepare("SELECT id, nom, prenom FROM praticiens where idCabinet=0 OR idCabinet=NULL AND nom LIKE :nom");
	$sth->execute(array(':nom'=>$keyword));
	$rows = array();
	while ($r = $sth->fetch(PDO::FETCH_ASSOC)) {
		array_push($rows, array(
		value=>$r['id'],
		label=>$r['nom'].' '.$r['prenom']
		));
	}
	echo $Json=json_encode($rows);
?>

